/**
* <p>Deck of Cards</p>
* <p>Description:CS 235 Assignment #1</p>
* @author Luke Vang
* @email luke.vang@my.uwrf.edu
* @author
Name2
* @email
name2.here@my.uwrf.edu
* @author
Name3
* @email
name3.here@my.uwrf.edu
* @date
March 1st 2013
*/

package DeckOfCards;

public class Main {
	public static void main(String[] args) {
		PlayingCards[] deck = new PlayingCards[52]; // PlayingCards array called
													// deck. The deck is size
													// 52.
		int i = 0; // start at card number 1;
		int f = 0;// start at card 1 for hand 1
		int q = 0; // start at card 1 for hand 2
		int u = 0; // start at card 1 for hand 3

		/*
		 * This loop goes through all the values int the enum calles and stores
		 * them in each PlayingCards object The loop starts at 0, then
		 * increments from 0 to 1... etc.. till it fill[s the 52 PlayingCard
		 * objects
		 */
		for (int j = 0; j < 13; j++) {
			for (int k = 0; k < 4; k++) {
				deck[i] = new PlayingCards(Rank.values()[j], Suit.values()[k]);
				i++;
			}// end of nested for loop

		}// end of for loop
		deck = PlayingCards.shuffle(deck);// calling the shuffle method from
											// PlayingCards class, and setting
											// deck equal to the new shuffled
											// deck. Everytime program is ran,
											// deck will be shuffled randomly
		Hand[] hand1 = new Hand[52]; // initialize hand1
		/*
		 * This loop goes through cards 0 - 16 in deck and stores their rank and
		 * suit value in hand 1 These print commands print from the cards 1-17,
		 * and 1-18.. so no nulls are printed
		 */
		for (int k = 0; k < 17; k++) {
			hand1[f] = new Hand(deck[k].getRank(), deck[k].getSuit());
			f++;
		}
		System.out.println("This is Hand 1: " + '\n');
		for (int v = 0; v < 17; v++) {
			System.out.println(hand1[v]);
		}
		System.out.println('\n');
		Hand[] hand2 = new Hand[52];// initialize hand2
		/*
		 * This loop goes through cards 17 - 33 and stores their rank and suit
		 * value into hand 2
		 */
		for (int z = 17; z < 34; z++) {
			hand2[q] = new Hand(deck[z].getRank(), deck[z].getSuit());
			q++;
		}

		System.out.println("This is Hand 2: " + '\n');
		for (int r = 0; r < 17; r++) {
			System.out.println(hand2[r]);
		}

		Hand[] hand3 = new Hand[52];// initial hand3
		/*
		 * This loop goes through cards number 34 - 52 and stores their rank and
		 * suit value into hand 3.
		 */
		for (int s = 34; s < 52; s++) {
			hand3[u] = new Hand(deck[s].getRank(), deck[s].getSuit());
			u++;
		}
		System.out.println('\n');
		System.out.println("This is Hand 3: " + '\n');
		for (int e = 0; e < 18; e++) {
			System.out.println(hand3[e]);
		}
		/******************************************************************************************************************************************/
		System.out
				.println("***************************************************************************************************************************");
		System.out.println('\n');

		hand1[1].swapCards(hand1, hand2, hand3, 0, 1, 2);// my method that will
															// swap the cards
															// and print out all
															// the swapped cards
															// correctly

	}// end of main
}// end of class
